package servers;

import interfaces.Constantes;
import model.User;
import view.Principal;

public class Cliente implements Constantes{
	
	private Principal frame;
	private User user;
	
	public Cliente() throws Exception{
		
		this.frame = new Principal(this);
		
	}
	
	public void connectToServer() throws Exception{
		//Implementar a conexao com o servidor
		//processServerMessage(); // deve ficar dentro de algum run(se tiver)
		
	}
	
	 public void sendMessageToServer(String message) throws java.io.IOException
	    {

			sendMessageToServer(new Message(PUBLIC_CHAT,message));
		}

		public void sendMessageToServer(Message message) throws java.io.IOException
		{
            //Implementar a troca de mensagens com o servidor
			message._user = user;
			message._host = "127.0.0.1";
		}

		public void processServerMessage() throws Exception
		{
			Message message = new Message(CLIENT_LOGIN);
			message._message = "Teste";
			message._header = 1;
			
			//frame.processServerMessage();
			
		}
	
	public void setUser(User user)
	{
		this.user = user;
	}
	
	public static void main(String args[]) throws Exception
    {
  		Cliente cliente = new Cliente();
  		

    }
	

}
